<meta charset='utf-8' />

<body style='padding:10px;color:#838'>
	<h1 style='text-align:center'>管理登陆</h1>

	<div style='width:250px;margin:0 auto'>
		<div>
			<span>用户名：</span>
			<span><input id='user' type="text"></span>
		</div><br>
		<div>
			<span>密　码：</span>
			<span><input id='pwd' type="password"></span>
		</div>

		<div style='text-align:center;margin-top:30px'>
			<button id='login'>登陆</button>
			<button onclick="location.replace('index.html')">返回</button>
		</div>
	</div>
</body>

<script src='./public/jquery.js'></script>
<script src='./public/fun.js'></script>
<script>
$(function(){
	$("#login").click(function(){
		var user = $('#user').val().trim();
		var pwd = $('#pwd').val().trim();
		if(!user || !pwd){
			return;
		}
		var data = {
			type:'login',
			user:user,
			pwd:pwd
		}
		Ajax(data,function(res){
			var tmp = _checkJsonFormat(res);
			if(tmp.stat == 'ok'){
				A('登陆成功！');
				sessionStorage.user = user;
				location.replace('index.html');
			}else{
				A('用户名或密码不正确！');
			}
		},'interface.php',1);

	});

});
</script>